import Vue from 'vue'
import App from './App'

import store from './store'

export const _this = Vue.prototype

_this.$store = store

import './assets/font/iconfont.css';
import './assets/css/style.css';
import './assets/css/animate.css';
import './assets/css/main.css';

// Api函数polyfill（目前为实验版本，如不需要，可删除！）';
import Polyfill from './polyfill/polyfill'
Polyfill.init()

// 全局mixins，用于实现setData等功能';
import Mixin from './polyfill/mixins'
Vue.mixin(Mixin)

Vue.config.productionTip = false

let api = require('./config/api.js')
let util = require('./utils/util.js')
_this.$api = (url, params, method) => {
  return new Promise((resolve, reject) => {
    util
      .request(api[url], params, method)
      .then((res) => {
        resolve(res)
      })
      .catch((err) => {
        reject(err)
      })
  })
}

import tabBot from './pages/index/tabBar.vue'
Vue.component('tabBot', tabBot)

import tabTop from './pages/index/tabTop.vue'
Vue.component('tabTop', tabTop)

import uView from 'uview-ui'
Vue.use(uView)

App.mpType = 'app'

const app = new Vue({
  ...App,
})
app.$mount()
